import api from '../index'
import type { ResponseData } from '../type'

export interface AgentSetting {
	repeatApply : 0 | 1
	multipleAreas : 0 | 1
	provinceState : 0 | 1
	provinceIcon : string
	cityState : 0 | 1
	cityIcon : string
	areaState : 0 | 1
	areaIcon : string
	townState : 0 | 1
	townIcon : string
	agreementState : 0 | 1
	agreementContent : string
	background : string
	levelNumber : number
}
// 获取-区域代理设置
export const getAgentSetting = () =>
	api.get<ResponseData<AgentSetting>>('customer/api/agent/base')
export interface AgentApplyItem {
	createTime : string
	userPhone ?: string
	userNickName ?: string
	userPhoto ?: string
	id : number
	userId : string
	agentAddress : string
	agentArea : number
	agentLevel : number
	state : 0 | 1 | 2,
	reason ?: string
}
// 获取申请记录
export const getAgentApplyList = () =>
	api.get<ResponseData<AgentApplyItem[]>>('customer/api/agent/apply/list')

export interface AgentApplyParams {
	agentLevel : number,
	agentArea : number
}
// 申请区域代理
export const addAgentApply = (data : AgentApplyParams) =>
	api.post('customer/api/agent/apply', {
		data,
		custom: {
			isLoading:true,
			showMsg: true
		}
	})